<?php
/**
 * Created by PhpStorm.
 * User: xaq
 * Date: 2017/5/26
 * Time: 17:14
 */

namespace app\api\model;

use app\api\model\BaseModel;
use app\lib\enum\ScopeEnum;

class Question extends BaseModel
{
    protected $hidden = ['user_id','delete_time'];

    protected $updateTime = false;

    public function items() {
        //一对多的关系
        return $this->hasMany('Answer','qid','id');
    }

    public static function getQuestions($page) {
        $question = self::with('items')->page($page,ScopeEnum::ListRow)->select();
        //echo self::getLastSql();
        return $question;
    }
}